<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript" src="js/jquery.js"></script>
<link href="js/upload/uploadify.css" rel="stylesheet" type="text/css" />
<script src="js/upload/swfobject.js" type="text/javascript"></script>
<script src="js/upload/jquery.uploadify.v2.1.4.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
//当文档加载完毕时候，自动下列脚本
$(document).ready(function() {
	//获取下面的文件上传组件，组件idtxtImgurl
  	$('#txtImgurl').uploadify(
		{'uploader':'js/upload/uploadify.swf', //文件上传的动画效果
			'script':'doImgUp.jsp',  //文件上传的后台处理界面
			'cancelImg':'js/upload/cancel.png', //文件上传的取消按钮图片
			'auto':true, //采用自动上传方式
			'folder':'upload',//上传到upload文件夹中
			'multi':true,  //是否支持多文件上传
			'simUploadLimit':99,  //文件上传的最大个数
			'buttonImg':'js/upload/upimg.gif',  //文件上传按钮图片
			'fileExt':'*.gif;*.png;*.jpg;*.bmp;',//允许上传的文件格式
			'fileDesc':'*.gif,bmp,jpg,png等图片文件',//弹出文件选择窗口下面的提示
			'queueID':'divup',  //用来显示进度到id=divup的div组件
			'sizeLimit':1024000,  //单文件上传的最大大小
			'onComplete':function(event, ID, fileObj, response, data) {//文件上传的后续操作
			     var show=document.getElementById("showfilename").value;
			     document.getElementById("showfilename").value = show + response;
		       
		        //var div=document.getElementById("showdiv").innerHTML;
		       // document.getElementById("showdiv").innerHTML=div+response;
		        $("#showdiv").append(response);
		        var imgUrl ="<img src='/ee_11_upload/upload/"+ response +"' width=200px height=200px/>";
		        $("#showImg_").append(imgUrl);
    		}
    	});
	}
);
</script>
</head>

<body>
	<form action="DoFileup2" method="post">
		用户名<input name="username"><br> 
		密码<input type="password"name="userpwd"><br>
		<input type="file" name="txtImgurl" id="txtImgurl"><br> 
		<input type="hidden" id="showfilename" name="showfilename">
		<div id="divup"></div>
		缩略图：<div id="showImg_"></div>
		<div id="showdiv"></div>
		<input type="submit" value="提交">
	</form>
</body>
</html>
